/******************************************************************************
*	UART of CC2541
*	by longcd
*/

#ifndef __CC2541_UART_H
#define __CC2541_UART_H

/*-----------------------------------------------------------------------------
						register bits define
-----------------------------------------------------------------------------*/
//UxCSR
#define UART_MODE		(1U << 7)
#define RX_ENABLE		(1U << 6)
#define RX_BYTE			(1U << 2)
#define TX_BYTE			(1U << 1)

//UxUCR
#define ODD_PARITY			0
#define EVEN_PARITY			(1U << 5)
#define DATA_8BIT			0
#define DATA_9BIT			(1U << 4)
#define PARITY_DISABLE		0
#define PARITY_EBAVLE		(1U << 3)
#define STOP_BITS_1			0
#define STOP_BITS_2			(1U << 2)
#define STOP_LEVEL_LOW		0
#define STOP_LEVEL_HIGH		(1U << 1)
#define START_LEVEL_LOW		0
#define START_LEVEL_HIGH	(1U << 0)

//U0GCR
#define LSB_FIRST			0
#define MSB_FIRST			(1U << 5)

//TCON
#define URX0IF				(1U << 3)

//IEN0 (0xA8) – Interrupt Enable 0
#define URX0IE				(1U << 2)

extern void UART0_RX_callback(uint8 buf);
void UART0_Init(uint8 dataBits,uint8 stopBits,uint32 baudrate);
void UART0_TransmitByte(uint8 Data);


#endif

